<template lang="html">
  <header>头部内容:{{headerName}}</header>
</template>

<script>
import Event from '@/assets/script/observer'
export default {
  data () {
    return {
      headerName: ""
    }
  },
  mounted() {
    var self = this;
    var header = (function () {
      Event.listen("change", function(data) {
        header.changeName(data)
      })
      return {
        changeName: function (data) {
          self.headerName = data;
        }
      }
    })();
  }
}
</script>

<style lang="scss" scoped>
header{
  background: red;
  color: white;
}
</style>
